<?php
$this->title = "Book Store";
$this->image_path= $this->baseUrl() . '/images/';
$this->headTitle($this->title);
?>
<p><a href="<?php echo $this->url(array('controller'=>'index','action'=>'add'));?>">Add a Book</a></p>
<table>
    <tr>
        <th width="70px"></th>
        <th width="150px">Title</th>
        <th width="120px">Author</th>
        <th width="120px">Price</th>
        <th width="120px">Action</th>
    </tr>
    <?php foreach($this->paginator as $book) : ?>
    <tr>
        <td><img src="<?php if($book['image']!==null) echo $this->image_path . $book['image']; else echo $this->image_path . 'item-old.png'; ?>" style="width: 50px;height: 50px;"/></td>
        <td><?php echo $this->escape($book['title']);?></td>
        <td><?php echo $this->escape($book['author']);?></td>
        <td><?php echo $this->escape($book['price']).' '.$this->escape($book['currency'])?></td>
        <td>
            <a href="<?php echo $this->url(array('controller'=>'index',
            'action'=>'edit', 'id'=>$book['id']));?>">Edit</a>
            <a href="<?php echo $this->url(array('controller'=>'index',
            'action'=>'delete', 'id'=>$book['id']));?>">Delete</a>
        </td>
    </tr>
    <?php endforeach; ?>        
</table>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>
